/*
 * @Descripttion:
 * @version: 1.0.0
 * @Author: htang
 * @Date: 2024-03-06 19:17:47
 * @LastEditors: htang
 * @LastEditTime: 2024-03-11 15:10:36
 */
import { defHttp } from '/@/utils/http/axios';
import { createVNode } from 'vue';
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { Modal, message } from 'ant-design-vue';

const API = {
  // 设备列表
  devices: '/wvp/device/query/devices',
  // 查询国标树
  deviceTree: '/wvp/device/query/tree/',
  // 开始点播
  playStart: '/wvp/play/start/',
  // 开始视频回放
  playbackStart: '/wvp/playback/start/',
  // 录像查询
  query: '/wvp/query/',
  // 停止视频回放
  playbackStop: '/wvp/stop/'
}

/**
 * 设备列表
 * @param {int} stationCode 站点编码
 * @returns
 */
export const wvpDevicesApi = async (params) => {
  return await defHttp.get({ url: API.devices, params });
}

/**
 * 查询国标树
 * @param {int} deviceId 设备ID
 * @returns
 */
export const wvpDeviceTreeApi = async (deviceId, params) => {
  return await defHttp.get({ url: `${API.deviceTree}${deviceId}`, params });
}

/**
 * 开始点播
 * @param {int} deviceId 设备ID
 * @param {int} channelId 通道ID
 * @returns
 */
export const wvpPlayStartApi = async (query, params) => {
  let { deviceId, channelId } = query;
  return await defHttp.get({ url: `${API.playStart}${deviceId}/${channelId}`, params });
}

/**
 * 录像查询
 * @param {int} deviceId 设备ID
 * @param {int} channelId 通道ID
 * @param {int} startTime 开始时间
 * @param {int} endTime 结束时间
 * @returns
 */
export const wvpPlaybackQueryApi = async (query, params) => {
  let { deviceId, channelId } = query;
  return await defHttp.get({ url: `${API.query}${deviceId}/${channelId}`, params });
}

/**
 * 停止视频回放
 * @param {int} deviceId 设备ID
 * @param {int} channelId 通道ID
 * @param {int} stream 视频流ID
 * @returns
 */
export const wvpPlaybackStopApi = async (query, params) => {
  let { deviceId, channelId, streamId } = query;
  return await defHttp.get({ url: `${API.playbackStop}${deviceId}/${channelId}/${streamId}`, params });
}

/**
 * 开始点播回放
 * @param {int} deviceId 设备ID
 * @param {int} channelId 通道ID
 * @param {int} stationName 站点名称
 * @returns
 */
export const wvpPlaybackStartApi = async (query, params) => {
  let { deviceId, channelId } = query;
  return await defHttp.get({ url: `${API.playbackStart}${deviceId}/${channelId}`, params });
}